/**
 * 
 */
package com.googlecode.agiletools.codereview;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.googlecode.agiletools.authority.User;
import com.googlecode.agiletools.type.BaseObject;

/**
 * The review record.
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "agiletools_reviewrecord")
public class ReviewRecord extends BaseObject {

    private static final long serialVersionUID = 5725800247077671824L;

    private static final String TAG_SPLITOR = ",|，|\\s";

    /**
     * The category of the issue.
     */
    private String tags;

    /**
     * The detail of the issue.
     */
    private String comment;

    /**
     * When the review record is created.
     */
    private Date date;

    /**
     * The file name or class name of the reviewing source code.
     */
    private String file;

    /**
     * The start line number.
     */
    private Integer lineFrom;

    /**
     * The end line number.
     */
    private Integer lineTo;

    /**
     * Who performs the review.
     */
    private User reviewer;

    /**
     * The revision number of the source code
     */
    private Integer revision;

    /**
     * @return the comment
     */
    @Column(nullable = false)
    public String getComment() {
	return comment;
    }

    /**
     * @return the date
     */
    public Date getDate() {
	return date;
    }

    /**
     * @return the file
     */
    @Column(nullable = false)
    public String getFile() {
	return file;
    }

    /**
     * @return the lineFrom
     */
    @Column(nullable = true)
    public Integer getLineFrom() {
	return lineFrom;
    }

    /**
     * @return the lineTo
     */
    @Column(nullable = true)
    public Integer getLineTo() {
	return lineTo;
    }

    /**
     * @return the reviewer
     */
    @Transient
    public User getReviewer() {
	return reviewer;
    }

    /**
     * @return the revision
     */
    @Column(nullable = false)
    public Integer getRevision() {
	return revision;
    }

    @Transient
    public String[] getTagList() {
	return tags.split(TAG_SPLITOR);
    }

    /**
     * @return the tags
     */
    public String getTags() {
	return tags;
    }

    /**
     * @param comment
     *            the comment to set
     */
    @Lob
    public void setComment(String comment) {
	this.comment = comment;
    }

    /**
     * @param date
     *            the date to set
     */
    public void setDate(Date date) {
	this.date = date;
    }

    /**
     * @param file
     *            the file to set
     */
    public void setFile(String file) {
	this.file = file;
    }

    /**
     * @param lineFrom
     *            the lineFrom to set
     */
    public void setLineFrom(Integer lineFrom) {
	this.lineFrom = lineFrom;
    }

    /**
     * @param lineTo
     *            the lineTo to set
     */
    public void setLineTo(Integer lineTo) {
	this.lineTo = lineTo;
    }

    /**
     * @param reviewer
     *            the reviewer to set
     */
    public void setReviewer(User reviewer) {
	this.reviewer = reviewer;
    }

    /**
     * @param revision
     *            the revision to set
     */
    public void setRevision(Integer revision) {
	this.revision = revision;
    }

    /**
     * @param tags
     *            the tags to set
     */
    public void setTags(String tags) {
	this.tags = tags;
    }

}
